let express = require('express');

let app = express();
// console.log(app);
app.listen(3000, () => {
  console.log('listen 3000');
});



function middleware1(req, res, next) {
  console.log('middleware1', 'before next');
  next();
  console.log('middleware1', 'after next');
}
function middleware2(req, res, next) {
  console.log('middleware2', 'before next');
  // next();
  console.log('middleware2', 'after next');
}
function middleware3(req, res, next) {
  console.log('middleware3', 'before next');
  next();
  console.log('middleware3', 'after next');
}
//app.use 原理是什么 中间件 : 函数
app.use(middleware1);
app.use(middleware2);
app.use(middleware3);
// express 内部维护一个函数数组 这个函数数组标识在发出响应之前要执行所有函数 这就是中间件数组
